package com.bo.threadEnd;

/**
 * @Author: gpb
 * @Date: 2024/7/15 22:24
 * @Description:
 */
public class Flag {

    static volatile Boolean flag = true;

    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(() -> {
            while (flag){
                System.out.println("thread is running");
            }
            System.out.println("thread is stop");
        });
        thread.start();
        Thread.sleep(1000);
        flag = false;
    }

}
